package net.hmr_radio.hmrbot.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2011-08-09 16:04:03")
/** */
public final class BotMeta extends org.slim3.datastore.ModelMeta<net.hmr_radio.hmrbot.model.Bot> {

    /** */
    public final org.slim3.datastore.StringAttributeMeta<net.hmr_radio.hmrbot.model.Bot> accessToken = new org.slim3.datastore.StringAttributeMeta<net.hmr_radio.hmrbot.model.Bot>(this, "accessToken", "accessToken");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<net.hmr_radio.hmrbot.model.Bot> accessTokenSecret = new org.slim3.datastore.StringAttributeMeta<net.hmr_radio.hmrbot.model.Bot>(this, "accessTokenSecret", "accessTokenSecret");

    /** */
    public final org.slim3.datastore.UnindexedAttributeMeta<net.hmr_radio.hmrbot.model.Bot, com.google.appengine.api.datastore.Text> description = new org.slim3.datastore.UnindexedAttributeMeta<net.hmr_radio.hmrbot.model.Bot, com.google.appengine.api.datastore.Text>(this, "description", "description", com.google.appengine.api.datastore.Text.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<net.hmr_radio.hmrbot.model.Bot, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<net.hmr_radio.hmrbot.model.Bot, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<net.hmr_radio.hmrbot.model.Bot, java.util.Date> lastRun = new org.slim3.datastore.CoreAttributeMeta<net.hmr_radio.hmrbot.model.Bot, java.util.Date>(this, "lastRun", "lastRun", java.util.Date.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<net.hmr_radio.hmrbot.model.Bot> name = new org.slim3.datastore.StringAttributeMeta<net.hmr_radio.hmrbot.model.Bot>(this, "name", "name");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<net.hmr_radio.hmrbot.model.Bot> ownerId = new org.slim3.datastore.StringAttributeMeta<net.hmr_radio.hmrbot.model.Bot>(this, "ownerId", "ownerId");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<net.hmr_radio.hmrbot.model.Bot, java.lang.Boolean> stop = new org.slim3.datastore.CoreAttributeMeta<net.hmr_radio.hmrbot.model.Bot, java.lang.Boolean>(this, "stop", "stop", java.lang.Boolean.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<net.hmr_radio.hmrbot.model.Bot> twitterId = new org.slim3.datastore.StringAttributeMeta<net.hmr_radio.hmrbot.model.Bot>(this, "twitterId", "twitterId");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<net.hmr_radio.hmrbot.model.Bot, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<net.hmr_radio.hmrbot.model.Bot, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final BotMeta slim3_singleton = new BotMeta();

    /**
     * @return the singleton
     */
    public static BotMeta get() {
       return slim3_singleton;
    }

    /** */
    public BotMeta() {
        super("Bot", net.hmr_radio.hmrbot.model.Bot.class);
    }

    @Override
    public net.hmr_radio.hmrbot.model.Bot entityToModel(com.google.appengine.api.datastore.Entity entity) {
        net.hmr_radio.hmrbot.model.Bot model = new net.hmr_radio.hmrbot.model.Bot();
        model.setAccessToken((java.lang.String) entity.getProperty("accessToken"));
        model.setAccessTokenSecret((java.lang.String) entity.getProperty("accessTokenSecret"));
        model.setDescription((com.google.appengine.api.datastore.Text) entity.getProperty("description"));
        model.setKey(entity.getKey());
        model.setLastRun((java.util.Date) entity.getProperty("lastRun"));
        model.setName((java.lang.String) entity.getProperty("name"));
        model.setOwnerId((java.lang.String) entity.getProperty("ownerId"));
        model.setStop((java.lang.Boolean) entity.getProperty("stop"));
        model.setTwitterId((java.lang.String) entity.getProperty("twitterId"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        net.hmr_radio.hmrbot.model.Bot m = (net.hmr_radio.hmrbot.model.Bot) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("accessToken", m.getAccessToken());
        entity.setProperty("accessTokenSecret", m.getAccessTokenSecret());
        entity.setUnindexedProperty("description", m.getDescription());
        entity.setProperty("lastRun", m.getLastRun());
        entity.setProperty("name", m.getName());
        entity.setProperty("ownerId", m.getOwnerId());
        entity.setProperty("stop", m.getStop());
        entity.setProperty("twitterId", m.getTwitterId());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        net.hmr_radio.hmrbot.model.Bot m = (net.hmr_radio.hmrbot.model.Bot) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        net.hmr_radio.hmrbot.model.Bot m = (net.hmr_radio.hmrbot.model.Bot) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        net.hmr_radio.hmrbot.model.Bot m = (net.hmr_radio.hmrbot.model.Bot) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        net.hmr_radio.hmrbot.model.Bot m = (net.hmr_radio.hmrbot.model.Bot) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        net.hmr_radio.hmrbot.model.Bot m = (net.hmr_radio.hmrbot.model.Bot) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        if(m.getAccessToken() != null){
            writer.setNextPropertyName("accessToken");
            encoder0.encode(writer, m.getAccessToken());
        }
        if(m.getAccessTokenSecret() != null){
            writer.setNextPropertyName("accessTokenSecret");
            encoder0.encode(writer, m.getAccessTokenSecret());
        }
        if(m.getDescription() != null && m.getDescription().getValue() != null){
            writer.setNextPropertyName("description");
            encoder0.encode(writer, m.getDescription());
        }
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder0.encode(writer, m.getKey());
        }
        if(m.getLastRun() != null){
            writer.setNextPropertyName("lastRun");
            encoder0.encode(writer, m.getLastRun());
        }
        if(m.getName() != null){
            writer.setNextPropertyName("name");
            encoder0.encode(writer, m.getName());
        }
        if(m.getOwnerId() != null){
            writer.setNextPropertyName("ownerId");
            encoder0.encode(writer, m.getOwnerId());
        }
        if(m.getStop() != null){
            writer.setNextPropertyName("stop");
            encoder0.encode(writer, m.getStop());
        }
        if(m.getTwitterId() != null){
            writer.setNextPropertyName("twitterId");
            encoder0.encode(writer, m.getTwitterId());
        }
        if(m.getVersion() != null){
            writer.setNextPropertyName("version");
            encoder0.encode(writer, m.getVersion());
        }
        writer.endObject();
    }

    @Override
    protected net.hmr_radio.hmrbot.model.Bot jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        net.hmr_radio.hmrbot.model.Bot m = new net.hmr_radio.hmrbot.model.Bot();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("accessToken");
        m.setAccessToken(decoder0.decode(reader, m.getAccessToken()));
        reader = rootReader.newObjectReader("accessTokenSecret");
        m.setAccessTokenSecret(decoder0.decode(reader, m.getAccessTokenSecret()));
        reader = rootReader.newObjectReader("description");
        m.setDescription(decoder0.decode(reader, m.getDescription()));
        reader = rootReader.newObjectReader("key");
        m.setKey(decoder0.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("lastRun");
        m.setLastRun(decoder0.decode(reader, m.getLastRun()));
        reader = rootReader.newObjectReader("log");
        reader = rootReader.newObjectReader("name");
        m.setName(decoder0.decode(reader, m.getName()));
        reader = rootReader.newObjectReader("ownerId");
        m.setOwnerId(decoder0.decode(reader, m.getOwnerId()));
        reader = rootReader.newObjectReader("stop");
        m.setStop(decoder0.decode(reader, m.getStop()));
        reader = rootReader.newObjectReader("twitterId");
        m.setTwitterId(decoder0.decode(reader, m.getTwitterId()));
        reader = rootReader.newObjectReader("version");
        m.setVersion(decoder0.decode(reader, m.getVersion()));
        return m;
    }
}